package br.edu.unifei.mestrado.unfold;

import br.edu.unifei.mestrado.commons.graph.GraphWrapper;
import br.edu.unifei.mestrado.commons.partition.AbstractPartitionIndex;
import br.edu.unifei.mestrado.mem.graph.Graph;
import br.edu.unifei.mestrado.mem.graph.PartitionIndexMem;
import br.edu.unifei.mestrado.mn.GraphViewMem;

public class UnfoldMemory extends Unfold {

	private String graphFileName;
	protected GraphWrapper grafo = null;
	private GraphViewMem view = new GraphViewMem();

	public UnfoldMemory(String graphFileName) {
		this.grafo = new Graph(GraphWrapper.NO_LEVEL, graphFileName);
		this.graphFileName = graphFileName;
	}
	
	@Override
	public GraphWrapper createNewGraph(int newLevel) {
		Graph grafo = new Graph(newLevel, graphFileName);
		return grafo;
	}
	
	@Override
	public GraphWrapper getGraph() {
		return grafo;
	}
	
	@Override
	public AbstractPartitionIndex getPartitionIndex(int k) {
		return new PartitionIndexMem(k);
	}

	//metodos da view
	
	@Override
	public void initView(GraphWrapper initialGraph) {
		view.initView(initialGraph);
	}

	@Override
	public void setShowView(boolean showView) {
		view.setShowView(showView);
	}

	@Override
	public void updateView(GraphWrapper grafo, int level, String it, int cutWeight) {
		view.updateView(grafo, level, it, cutWeight);
	}

	@Override
	public void updateViewCoarsed(GraphWrapper grafo, int level, String it, int cutWeight) {
		view.updateViewCoarsed(grafo, level, it, cutWeight);
	}
	
	@Override
	public void repaint() {
		view.repaint();
	}

}
